home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
098
/
rbbslist.bas
< prev
next >
Wrap
BASIC Source File
|
1985-06-03
|
5KB
|
126 lines
10 ' RBBS-PC USERS DIRECTORY UPDATE PROGRAM
20 ' BY JOHN CERVENY 6/8/84, MODIFIED AND COMPILED BY LOREN D. JONES
30 '
40 DIM NAME.SORT$(2000)
50 DEFINT A-Z
60 '
70 ' PRINT THE TITLE PAGE ON THE SCREEN.
80 '
90 CLS
100 LOCATE 7,18:PRINT STRING$(45,42)
110 PRINT TAB(18);"*";TAB(62);"*"
120 PRINT TAB(18);"* RBBS - PC USERS DIRECTORY UPDATE PROGRAM *"
130 PRINT TAB(18);"* *"
140 PRINT TAB(18);"* by John Cerveny *"
150 PRINT TAB(18);"* *"
160 PRINT TAB(18);"* modified & compiled by Loren D. Jones *"
170 PRINT TAB(18);"*";TAB(62);"*"
180 PRINT TAB(18);STRING$(45,42)
190 LOCATE 18,26,0:PRINT"PRESS SPACE BAR TO CONTINUE"
200 ' POKE 106,0
210 CMD$ = INKEY$
220 IF CMD$ = ""THEN GOTO 210
230 IF CMD$ = CHR$(27) THEN GOTO 1240
240 IF CMD$ = " " THEN GOTO 290
250 GOTO 200
260 '
270 ' ASK THE USER FOR THE SOURCE AND DESTINATION FILES.
280 '
290 CLS:PRINT:INPUT "What is the SOURCE file? (default file is USERS)";SOURCE$
300 PRINT: IF SOURCE$="" THEN SOURCE$="USERS"
310 INPUT "What is the DESTINATION file? (default file is BULLET4)";DESTIN$
320 PRINT: IF DESTIN$="" THEN DESTIN$="BULLET4"
330 PRINT:PRINT "ENTER 1 TO PROCEED WITH UPDATE OF USER FILE, "
340 PRINT " 2 TO CHANGE THE SOURCE AND DESTINATION FILES,"
350 INPUT " 3 TO ABORT THE PROGRAM.";CHOICE$
360 IF CHOICE$="" GOTO 400
370 IF ASC(CHOICE$)<49 OR ASC(CHOICE$)>51 THEN GOTO 400
380 IF CHOICE$="1"GOTO 410 ELSE IF CHOICE$="2"GOTO 290
390 IF CHOICE$="3" GOTO 1240
400 PRINT:PRINT"INVALID CHOICE. PLEASE CHOOSE 1, 2, OR 3": GOTO 330
410 CLS: PRINT: PRINT "USER FILE UPDATE RUN STARTED AT ";TIME$ :BTIM$=TIME$:PRINT
420 '
430 ' CHECK TO SEE IF THE SOURCE FILE EXISTS.
440 '
450 ON ERROR GOTO 1230
460 OPEN SOURCE$ FOR INPUT AS #1 : CLOSE #1
470 '
480 ' THE SOURCE FILE (WHICH SHOULD BE IN SEQUENTIAL FORMAT) IS OPENED FOR
490 ' INPUT. THE NAMES FROM THE SOURCE FILE ARE SWITCHED FROM THE FIRST
500 ' NAME - LAST NAME FORMAT TO ONE OF LAST NAME - FIRST NAME, AND A COMMA
510 ' IS INSERTED IN BETWEEN THE LAST AND FIRST NAMES.
520 '
530 OPEN "R",1,SOURCE$,128:END.USER=LOF(1)/128
540 FIELD 1,31 AS N$
550 COUNT = 1
560 IF COUNT > END.USER THEN GOTO 700
570 LOCATE 8,5:PRINT END.USER; "Records in file."
580 LOCATE 10,5:PRINT "Reading record: "; COUNT: GET 1,COUNT
590 IF LEFT$(N$,1)<"0" THEN 700
600 FSTBLKN = INSTR(N$," ")
610 SNDBLKN = INSTR(FSTBLKN + 1,N$," ") - 1
620 IF SNDBLKN < 1 THEN GOTO 680
630 USER.NAME$ = LEFT$(N$,SNDBLKN)
640 LAST.NAME = (SNDBLKN - FSTBLKN)
650 USER.NAME$ = RIGHT$(USER.NAME$,LAST.NAME) + ", " +LEFT$(USER.NAME$,FSTBLKN)
660 I = I + 1
670 NAME.SORT$(I) = USER.NAME$
680 COUNT = COUNT + 1: GOTO 560
690 CLOSE #1
700 '
710 ' THE USER NAME LISTING WILL NOW BE SORTED AND SENT TO THE DESTINATION FILE
720 ' THE NEW CONTENTS OF THE FILE WILL APPEAR ON THE SCREEN AS WELL.
730 '
740 OPEN DESTIN$ FOR OUTPUT AS #2
750 LOCATE 14,5:PRINT "Sorting....please stand by."
760 NROW% = COUNT
770 ' ======== Sort subroutine (Shell - Metzner sort) ========
780 JUMP% = NROW%
790 WHILE JUMP% <> 0
800 JUMP% = JUMP% \ 2
810 J2% = NROW% - JUMP%
820 J% = 1
830 WHILE J% <= J2%
840 I% = J%
850 WHILE I% > 0
860 J3% = I% + JUMP%
870 IF (NAME.SORT$(I%) <= NAME.SORT$(J3%)) THEN 910
880 SWAP NAME.SORT$(I%), NAME.SORT$(J3%)
890 I% = I% - JUMP%
900 WEND
910 J% = J% + 1:LOCATE 16,5:PRINT J%
920 WEND
930 WEND
940 PRINT:PRINT "THE FILE '";DESTIN$;"' WILL APPEAR AS FOLLOWS:":PRINT
950 S$ = STRING$(79,42)
960 PRINT #2, S$
970 PRINT S$
980 PRINT #2, "*";TAB(79);"*"
990 PRINT "*"; TAB(79);"*"
1000 PRINT #2,"*"; TAB(30);"-- USERS DIRECTORY --";TAB(79);"*"
1010 PRINT "*"; TAB(30);"-- USERS DIRECTORY --";TAB(79);"*"
1020 PRINT #2, "*"; TAB(79);"*"
1030 PRINT "*"; TAB(79); "*"
1040 COL = (I+1)/3
1050 X=1: Y=COL+1: Z=COL*2+1
1060 FOR C=1 TO COL
1070 PRINT #2, "* ";NAME.SORT$(X); TAB(33); NAME.SORT$(Y); TAB(57);
1080 PRINT #2, NAME.SORT$(Z); TAB(79);"*"
1090 PRINT "* ";NAME.SORT$(X); TAB(33); NAME.SORT$(Y); TAB(57);
1100 PRINT NAME.SORT$(Z); TAB(79);"*"
1110 X=X+1 : Y=Y+1 : Z=Z+1
1120 NEXT C
1130 PRINT #2, "*";TAB(79);"*"
1140 PRINT "*"; TAB(79); "*"
1150 PRINT #2, "*";TAB(79);"*"
1160 PRINT "*"; TAB(79); "*"
1170 PRINT #2, S$
1180 PRINT S$
1190 PRINT : PRINT "USER FILE UPDATE RUN ENDED AT ";TIME$: PRINT
1200 PRINT : PRINT "USER FILE UPDATE RUN BEGAN AT ";BTIM$: PRINT
1210 CLOSE #2
1220 GOTO 1240
1230 PRINT "SOURCE FILE COULD NOT BE FOUND."
1240 PRINT: PRINT "END OF PROGRAM"
1250 END